<template>
	<view class="self">
		<view class="userMsg flex">
			<image :src="info.avatar_url" mode="aspectFill" class="avatar"></image>
			<view class="right">
				<view class="name">{{info.nickname}}</view>
				<view class="tel">{{info.phone}}</view>
			</view>
		</view>
		<view class="list-box">
			<view class="list flex-between" @click="goPage('/pages/self/wallet')">
				<view class="left flex">
					<image src="/static/wallet.png" mode="widthFix"></image>
					我的钱包
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view>
			<view class="list flex-between" @click="goPage('/pages/self/shiming')">
				<view class="left flex">
					<image src="/static/shiming.png" mode="widthFix"></image>
					实名认证
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view>
			<view class="list flex-between" @click="goPage('/pages/self/chezhuCer')">
				<view class="left flex">
					<image src="/static/chezhu.png" mode="widthFix"></image>
					车主认证
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view>
			
			<view class="list flex-between" @click="goPage('/pages/self/carList')">
				<view class="left flex">
					<image src="/static/car.png" mode="widthFix"></image>
					我的车辆
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view>
			<view class="list flex-between" @click="goPage('/pages/self/pulish')">
				<view class="left flex">
					<image src="/static/tab2-a.png" mode="widthFix"></image>
					我的发布
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view>
			<view class="list flex-between" @click="goPage('/pages/self/trip')">
				<view class="left flex">
					<image src="/static/yuyue.png" mode="widthFix"></image>
					我的预约
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view>
			<view class="list flex-between"  @click="goPage('/pages/self/tripList')">
				<view class="left flex">
					<image src="/static/pingjia.png" mode="widthFix"></image>
					我的行程
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view>
			
			<view class="list flex-between" @click="goPage('/pages/self/modifyTel')">
				<view class="left flex">
					<image src="/static/mobile.png" mode="widthFix"></image>
					修改手机号
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view>
			<!-- <view class="list flex-between">
				<view class="left flex">
					<image src="/static/help.png" mode="widthFix"></image>
					帮助中心
				</view>
				<image src="/static/arrow.png" mode="widthFix" class="arrow"></image>
			</view> -->
		</view>
		<view class="flex-center-column footer">
			<view>Copyright © 2020-2021</view>
			<view>小王出行 版权所有</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:{},
				auth_status:-1,
				car_auth_status:-1,
			};
		},
		onLoad() {
		
			this.getInfo()
		},
		methods:{
			getInfo(){
				this.$https.get('user').then(res=>{
					this.info = res;
					this.auth_status = res.auth.status;
					this.car_auth_status = res.car_auth.status;
				})
			},
			goPage(url){
				if(url.includes('shiming')){
					uni.navigateTo({
						url:url
					})
				}else{
					if(this.auth_status == 0){
						if(url.includes('chezhuCer')){
							uni.navigateTo({
								url:url
							})
						}else{
							if(this.car_auth_status == 0){
								uni.navigateTo({
									url:url
								})
							}else{
								uni.showModal({
									content:'请先进性车主认证',
									confirmColor:'#4CD964',
									success:r=>{
										if(r.confirm){
											uni.navigateTo({
												url:'/pages/self/chezhuCer'
											})
										}
									}
								})
							}
							
						}
					}else{
						uni.showModal({
							content:'请先进性实名认证',
							confirmColor:'#4CD964',
							success:r=>{
								if(r.confirm){
									uni.navigateTo({
										url:'/pages/self/shiming'
									})
								}
							}
						})
					}
					
				}
				
				
				
			}
		}
	}
</script>

<style lang="less">
	@color: #4CD964;
	page{
		background: #eee;
	}
	.self{
		.userMsg{
			background:@color;
			padding: 30rpx;
			.avatar{
				width: 130rpx;
				height: 130rpx;
				border-radius: 50%;
				border:8rpx solid white;
				margin-right: 20rpx;
			}
			.right{
				color:white;
				.name{
					font-size: 34rpx;
					font-weight: bold;
					margin-bottom: 20rpx;
				}
				.tel{
					font-size: 26rpx;
				}
			}
		}
		.list-box{
			padding:15rpx 30rpx 30rpx;
			border-top: 20rpx solid #eee;
			background: white;
			.list{
				height: 100rpx;
				border-bottom: 1px solid #eee;
				.left{
					font-size: 32rpx;
					color:#333;
					image{
						width: 45rpx;
						height: auto;
						margin-right: 20rpx;
					}
				}
				.arrow{
					width: 36rpx;
					height: auto;
				}
			}
		}
		.footer{
			margin:30rpx 0 ;
			font-size: 26rpx;
			color:#999;
			line-height: 1.7;
		}
	}
</style>
